<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="Evernote Windows/303502 (zh-CN, DDL); Windows/6.3.9600 (Win64);"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="328"/>

<div>
<span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><b style="font-size: 19px;">MySQLdb安装步骤：</b></div><div><br/></div><div>在配置Django时，选择的是mysql数据库，要安装MySQLdb模块，不过安装过程中，遇到了很多errors，记录一下,主要来自各个博客的总结。</div><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">系统:ubuntu </p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">mysql:直接apt-get安装的，sudo apt-get install mysql-server    sudo apt-get install mysql-client</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">到官方下载 <a href="http://sourceforge.net/projects/mysql-python/" style="outline: none; text-decoration: none; color: rgb(61, 129, 238); border-bottom-width: 1px; border-bottom-style: dashed;" target="_blank">MySQL for Python</a></p><div style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><div>然后解压，打开README：</div></div><div style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><div>里面有安装过程：(1.2.1或者1.2.3都可以，亲测使用过)</div></div><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">  $ tar xfz MySQL-python-1.2.1.tar.gz <br/>
  $ cd MySQL-python-1.2.1 <br/>
  $ python setup.py build <br/>
  $ sudo python setup.py install</p><div> </div><div style="font-size: 19px;"><b>几个报错的地方与解决方案：</b></div><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">不过在python setup.py build时报错：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 192, 0);">ImportError: No module named setuptools</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">ubuntu下安装：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 0, 0);">sudo apt-get install python-setuptools</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><em><strong>python-setuptools ： Python Distutils Enhancements (setuptools compatibility)</strong></em></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"> </p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">然后再次python setup.py build，又报错：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 192, 0);">EnvironmentError: mysql_config not found</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">因为mysql_config是属于MySQL开发用的文件，而使用apt-get安装的MySQL是没有这个文件的，于是在包安装器里面寻找</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 0, 0);">sudo apt-get install  libmysqld-dev</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><em><strong>libmysqld-dev ： MySQL embedded database development files</strong></em></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"> </p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">再次运行python setup.py build，报错：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 192, 0);">building ‘_mysql’ extension <br/>
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,’final’,0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX <br/>
In file included from _mysql.c:29:0: <br/>
pymemcompat.h:10:20: fatal error: Python.h: No such file or directory</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">解决方案，</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 0, 0);">sudo apt-get install python-dev</span></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"><em><strong>python-dev ： header files and a static library for Python (default)</strong></em></p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);"> </p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">然后就按照README里的：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">  $ python setup.py build <br/>
  $ sudo python setup.py install</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">测试：</p><p style="font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; margin: 10px auto; color: rgb(51, 51, 51); font-size: 14px; text-align: left; widows: 1; background-color: rgb(255, 255, 255);">&gt;&gt;&gt;import MySQLdb</p><div>没有报错即可。</div><div><span style="background-color: rgb(255, 255, 255); color: rgb(51, 51, 51); font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; font-size: 14px; text-align: left; widows: 1;"><br/></span></div><div><span style="background-color: rgb(255, 255, 255); color: rgb(51, 51, 51); font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; font-size: 14px; text-align: left; widows: 1;">import MySQLdb报错的几个地方：</span></div><div style="font-size: 14px;"><span style="background-color: rgb(255, 255, 255); text-align: left; widows: 1;"><font face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><font color="#FF0000">/usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_mysql.pyc, but /root/soft/MySQL-python-1.2.3 is being added to sys.path</font></font></span></div><div><span style="background-color: rgb(255, 255, 255); text-align: left; widows: 1;"><font face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><font color="#333333"><span style="font-size: 14px;">解决办法：</span></font></font></span></div><div><span style="background-color: rgb(255, 255, 255); text-align: left; widows: 1;"><font color="#333333"><span style="font-size: 14px;">原因是，install后MySQLdb模块已经被放到python的site-pachages目录中；但我在当前目录也存在相同的模块，所以可能会重复导入。只要切换到其他目录运行就可以了。</span></font></span></div><div><font color="#333333"><span style="font-size: 14px;"><br/></span></font></div><div><span style="font-size: 14px;"><font color="#FF0000"> UserWarning: /home/server/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).</font></span></div><div style="text-align: left; widows: 1;"><font color="#FF0000" face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><span style="font-size: 14px;">warnings.warn(msg, UserWarning)</span></font></div><div style="text-align: left; widows: 1;"><font color="#333333" face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><span style="font-size: 14px;">解决办法：</span></font></div><div style="text-align: left; widows: 1;"><font color="#333333" face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><span style="font-size: 14px;">进入 /home/server/</span></font></div><div style="text-align: left; widows: 1;"><font color="#333333" face="Merriweather, Georgia, 微软雅黑, 黑体, 宋体"><span style="font-size: 14px;">chmod g-wx,o-wx .python-eggs/</span></font></div><div style="text-align: left; widows: 1;"><span style="color: rgb(51, 51, 51); font-family: Merriweather, Georgia, 微软雅黑, 黑体, 宋体; font-size: 14px;">就是给个权限~</span></div><div><br/></div><div>另外一个我曾经遇到的问题：</div><div><h1 style="margin: 0px; padding: 0px 0px 0px 5px; font-weight: bold; float: left; width: 926.344px; clear: both; font-size: 14px; color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 242);"><a href="http://www.cnblogs.com/xiazh/archive/2012/12/12/2814289.html" style="margin: 0px; padding: 0px; color: rgb(7, 93, 179); text-decoration: none;">mysql-python安装时EnvironmentError: mysql_config not found</a></h1><div style="margin: 5px 0px 0px; padding: 5px 2px 5px 5px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 242);"><div style="margin: 0px 0px 20px; padding: 0px; word-break: break-word;"><div style="margin: 10px auto; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; text-indent: 0px;"><div><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><br/></span></div><div><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">在安装 mysql-python时，会出现：</span></div></div><div style="margin: 5px 0px; padding: 5px; border: 1px solid rgb(204, 204, 204); overflow: auto; color: rgb(0, 0, 0); font-family: 'Courier New' !important; font-size: 12px !important; background-color: rgb(245, 245, 245);"><div style="margin: 5px 0px 0px; padding: 0px; background-color: rgb(245, 245, 245);"><span style="margin: 0px; padding: 0px 5px 0px 0px; font-family: 'Courier New' !important; font-size: 12px !important;"><a style="margin: 0px; padding: 0px; color: rgb(7, 93, 179); text-decoration: underline; border: none !important; background-color: rgb(245, 245, 245) !important;" title="复制代码"><img src="Python的MySQLdb模块安装_files/Image.gif" type="image/gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 900px; border: none !important; background-color: rgb(245, 245, 245) !important; height: auto;"/></a></span></div><pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: 'Courier New' !important; font-size: 12px !important;"><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">sh</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);">: mysql_config: not found
Traceback (most recent call </span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">last</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);">):
  File </span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">setup.py</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span>, line <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 128);">15</span>, <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">in</span> &lt;module&gt;<span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);">
    metadata, options </span>=<span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);"> get_config()
  File </span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span>, line <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 128);">43</span>, <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">in</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);"> get_config
    libs </span>= mysql_config(<span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">libs_r</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);">)
  File </span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span>, line <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 128);">24</span>, <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">in</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);"> mysql_config
    raise EnvironmentError(</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">%s not found</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(128, 0, 0);">&quot;</span> %<span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);"> (mysql_config.path,))
EnvironmentError: mysql_config not found</span></pre><div style="margin: 5px 0px 0px; padding: 0px; background-color: rgb(245, 245, 245);"><span style="margin: 0px; padding: 0px 5px 0px 0px; font-family: 'Courier New' !important; font-size: 12px !important;"><a style="margin: 0px; padding: 0px; color: rgb(7, 93, 179); text-decoration: underline; border: none !important; background-color: rgb(245, 245, 245) !important;" title="复制代码"><img src="Python的MySQLdb模块安装_files/Image [1].gif" type="image/gif" alt="复制代码" style="margin: 0px; padding: 0px; max-width: 900px; border: none !important; background-color: rgb(245, 245, 245) !important; height: auto;"/></a></span></div></div><p style="margin: 10px auto; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; text-indent: 0px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">只要原因是没有安装:libmysqlclient-dev</span></p><div style="margin: 5px 0px; padding: 5px; border: 1px solid rgb(204, 204, 204); overflow: auto; color: rgb(0, 0, 0); font-family: 'Courier New' !important; font-size: 12px !important; background-color: rgb(245, 245, 245);"><pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: 'Courier New' !important; font-size: 12px !important;"><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">sudo</span> apt-get <span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">install</span> libmysqlclient-dev
</pre></div><p style="margin: 10px auto; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; text-indent: 0px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">找到mysql_config文件的路径</span></p><div style="margin: 5px 0px; padding: 5px; border: 1px solid rgb(204, 204, 204); overflow: auto; color: rgb(0, 0, 0); font-family: 'Courier New' !important; font-size: 12px !important; background-color: rgb(245, 245, 245);"><pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: 'Courier New' !important; font-size: 12px !important;"><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">sudo</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 0);"> updatedb
</span><span style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important; color: rgb(0, 0, 255);">locate</span> mysql_config
</pre></div><p style="margin: 10px auto; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; text-indent: 0px;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">mysql_config的位置为：/usr/bin/mysql_config</span></p><div style="margin: 10px auto; padding: 0px; text-indent: 0px;"><div><span style="font-family: Verdana, Arial, Helvetica, sans-serif;">在mysql-python源码包下找到：<span style="margin: 0px; padding: 0px; color: rgb(0, 0, 0);">setup_posix.py 文件，然后找到文件中的 mysql_config.path 将其值改为：/usr/bin/mysql_config,然后 sudo python setup.py install ,就ok了</span></span></div><div><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><br/></span></div><div><h1 style="margin: 0px; padding: 0px 0px 0px 5px; font-weight: bold; float: left; width: 926.344px; clear: both; font-size: 14px; color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 242);"><a href="http://www.cnblogs.com/xiazh/archive/2012/07/31/2616474.html" style="margin: 0px; padding: 0px; color: rgb(170, 122, 83); text-decoration: underline;">安装python模块时出现：error: Setup script exited with error: command 'gcc' failed with exit status 1</a></h1><div style="margin: 5px 0px 0px; padding: 5px 2px 5px 5px; color: rgb(0, 0, 0); font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 242);"><div style="margin: 0px 0px 20px; padding: 0px; word-break: break-word;"><div style="margin: 10px auto; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; text-indent: 0px;"><div><br/></div><div>通过安装如下库即可解决：</div></div><div style="margin: 5px 0px; padding: 5px; border: 1px solid rgb(204, 204, 204); overflow: auto; color: rgb(0, 0, 0); font-family: 'Courier New' !important; font-size: 12px !important; background-color: rgb(245, 245, 245);"><div style="margin: 0px; padding: 0px; font-family: 'Courier New' !important; font-size: 12px !important;">sudo apt-get install python-dev<br/></div></div></div></div></div></div></div></div></div><div><br/></div></div></span>
</div></body></html> 